package net.chrisrichardson.ec2deployer.cluster

class ClusterSpecTest extends GroovyTestCase {

    public void testClosure() {
        def clusterSpec = new ClusterSpec().catalinaOptsBuilder({builder, databasePrivateDnsName ->})
        assertNotNull clusterSpec.catalinaOptsBuilderAsClosure
    }

    public void testStringClosure() {
        def clusterSpec = new ClusterSpec().catalinaOptsBuilder("{builder, databasePrivateDnsName ->}")
        assertNotNull clusterSpec.catalinaOptsBuilderAsClosure
    }

   public void testMakeTopology_default() {
       def clusterSpec = new ClusterSpec()
       assertTrue clusterSpec.makeTopology() instanceof SingleInstanceTopology
   }

   public void testMakeTopology_multiple() {
       def clusterSpec = new ClusterSpec().topology(MultipleInstancesTopology.simpleName)
       assertTrue clusterSpec.makeTopology() instanceof MultipleInstancesTopology
   }
}